{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import datasets\n",
    "\n",
    "iris = datasets.load_iris()\n",
    "X = iris.data[:, :2]\n",
    "y = iris.target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\yinahe\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n",
       "                   intercept_scaling=1, l1_ratio=None, max_iter=100,\n",
       "                   multi_class='ovr', n_jobs=None, penalty='l2',\n",
       "                   random_state=None, solver='warn', tol=0.0001, verbose=0,\n",
       "                   warm_start=False)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegression\n",
    "log_reg = LogisticRegression(multi_class='ovr')\n",
    "log_reg.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6578947368421053"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*100)).reshape(-1,1),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*100)).reshape(-1,1)\n",
    "    )\n",
    "    X_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "\n",
    "    y_predict = model.predict(X_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A','#FFF59D','#90CAF9'])\n",
    "\n",
    "    plt.contourf(x0, x1, zz, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3dfZBcdZ3v8fe3m8kTGUgGXPDmYaNLyocrCjoSQoz4dG9hsLCmNBusEcFlyUWiRl1LL4YKRQr0UrtFySqYCnKvgLncMWj2omRZ3VUwckOK4FOWB5egkgd5TgKJwyTD9Pf+0d2TmZ7uOae7T58+p8/nVZVi5ndOn/71YfKdk19/zrfN3RERkc6Xa/cEREQkHir4IiIZoYIvIpIRKvgiIhmhgi8ikhEq+CIiGRG64JtZ3sx+ZWY/qrLtEjN73sx+Xfrzt9FOU0REmnVcHfuuBh4DTqixfcDdP938lEREpBVCXeGb2VzgfODbrZ2OiIi0Stgr/K8DXwK6J9nnI2b2buA/gM+7+57KHcxsJbAS4PipU9+x8NRT65yuiEi2/fqpp15w99c08tjAgm9mHwKec/eHzew9NXb7IXCnux8xs8uB24D3Ve7k7huADQBnLljgP1uzppE5i4hk0m1nXMznzpr6VKOPD3OFvwS4wMyWA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x1fsk4RzGWae0N5zWelC4M4q40k4n2PVmie0+Xy6+z7gH4DdwNPAS+7+44rd6q6dLS34ZvYh4Dl3f3iy3aqMxZoVDTnPHwIL3P2twL9y7Ddr3Ja4+9sp/vN4lZm9u2J7289nSdA8fwn8pbu/DfgG8E8xz+844O3At9z9TODPwH+v2CcJ5zLMPNt9LkeVlpwuADZV21xlrC258IB5tv18mtlsilfwrwP+E3C8mVV2Pqz7fLb6Cn8JcIGZ/RH4P8D7zOy7FfvsBeYBlP7pciLxd+cMnKe7v+juR0rf3gK8I94pjs7jT6X/Pkdx7fGsil1Gz2fJXCb+U7DlguaZgJYce4G97r699P1dFAtr5T7tPpeB80zAuRzrg8Av3f3ZKtuScD7Las4zIefzA8Af3P15dx8GfgCcU7FP3bWzpQXf3a9097nuvoDiP59+6u6Vv6XuBi4uff3R0j6x/tYPM8+KtcYLKL65GyszO97MustfA/8VqOw4ejfwiVIi4myK/xR8OmnztDa35HD3Z4A9ZlbuPPh+4NGK3dp+LsPMs93nssLHqL1M0vbzOUbNeSbkfO4GzjazGaW5vJ+JNafu2hlXSmccM1sH7HD3uym+GXWHme2i+NvpwnbMqZqKeX7WzC4AXqU4z0vaMKVTgM2ln8XjgP/t7vea2eUw2upiC7AM2AUMAp9M6DwbbckRpc8AG0v/vP898MkEnssw80zCucTMZgD/BfhvY8YSdz5DzLPt59Pdt5vZXRSXl14FfgVsaLZ2qrWCiEhG6E5bEZGMUMEXEckIFXwRkYxQwRcRyQgVfBGRjFDBFxHJCBV8EZGM+P+aI60Sd9RY3QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(log_reg, axis=[4,8,1.5,4.5])\n",
    "plt.scatter(iris.data[iris.target==0,0],iris.data[iris.target==0,1], color='red')\n",
    "plt.scatter(iris.data[iris.target==1,0],iris.data[iris.target==1,1], color='blue')\n",
    "plt.scatter(iris.data[iris.target==2,0],iris.data[iris.target==2,1], color='green')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n",
       "                   intercept_scaling=1, l1_ratio=None, max_iter=100,\n",
       "                   multi_class='multinomial', n_jobs=None, penalty='l2',\n",
       "                   random_state=None, solver='newton-cg', tol=0.0001, verbose=0,\n",
       "                   warm_start=False)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegression\n",
    "log_reg2 = LogisticRegression(multi_class='multinomial', solver='newton-cg')\n",
    "log_reg2.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7894736842105263"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg2.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3dfZAchXnn8e+zwyKhN+sFH2DtSgpBZVkyBOw9QNEBju2LCbhwqQJeqA0yjoJOCNsCJ+U6ohRvZ1yVSgpDHARZLOcQKESGmByxFeKkbBOZA1UtGFsB4UORkVbYIIwkJCEklt3n/pjZ1e5oZrtnuqdfZn6fqi12u3t6nmng2d7u3zxj7o6IiDS/trQLEBGRZKjhi4i0CDV8EZ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yUXHlBn6sfTzGZQPIP/DeADwGQz+4PyzSo8dNzj2egz/CXAZWb2CvD3wMfNrHx83m6gE6D0p8v7SH46Z2Cd7v6mux8t/Xg/8NFkSxyp45elf+6heO3x3LJNRo5nSQfH/ynYcEF1ZmAkx25gt7tvKf38KMXGWr5N2scysM4MHMvRfg94zt1fr7AuC8dzWNU6M3I8Pwn8wt3fcPcB4DvAb5dtU3PvbGjDd/eb3L3D3edR/PPpB+5e/lvqceBzpe8vL22T6G/9MHWWXWu8jOLN3USZ2WQzmzr8PfC7QPnE0ceBZaVExPkU/xT8VdbqtJRHcrj7a0C/mQ1PHvwE8GLZZqkfyzB1pn0sy1xF9cskqR/PUarWmZHjuQs438wmlWr5BMf3nJp7Z1IpnTHM7Hagz90fp3gz6kEz207xt9OVadRUSVmdXzKzy4D3KNZ5TQolnQI8Vvpv8QTg79z9CTNbCSOjLjYBlwDbgcPA5zNaZ70jOeL0RWBD6c/7HcDnM3gsw9SZhWOJmU0C/jvwP0Yty9zxDFFn6sfT3beY2aMULy+9B/wE6I3aOzVaQUSkReidtiIiLUINX0SkRajhi4i0CDV8EZEWoYYvItIi1PBFRFqEGr6ISIv4/yR2D/S4qHR+AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(log_reg2, axis=[4,8,1.5,4.5])\n",
    "plt.scatter(iris.data[iris.target==0,0],iris.data[iris.target==0,1], color='red')\n",
    "plt.scatter(iris.data[iris.target==1,0],iris.data[iris.target==1,1], color='blue')\n",
    "plt.scatter(iris.data[iris.target==2,0],iris.data[iris.target==2,1], color='green')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用所有数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\yinahe\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.9473684210526315"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = iris.data\n",
    "y = iris.target\n",
    "from sklearn.model_selection import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "log_reg = LogisticRegression(multi_class='ovr')\n",
    "log_reg.fit(X_train, y_train)\n",
    "log_reg.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = iris.data\n",
    "y = iris.target\n",
    "from sklearn.model_selection import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "log_reg3 = LogisticRegression(multi_class='multinomial', solver='newton-cg')\n",
    "log_reg3.fit(X_train, y_train)\n",
    "log_reg3.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "把任何二分类问题转换为多分类问题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\yinahe\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n",
      "C:\\Users\\yinahe\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n",
      "C:\\Users\\yinahe\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.9473684210526315"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.multiclass import OneVsRestClassifier\n",
    "log_reg = LogisticRegression()\n",
    "ovr = OneVsRestClassifier(log_reg)\n",
    "ovr.fit(X_train, y_train)\n",
    "ovr.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\yinahe\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n",
      "C:\\Users\\yinahe\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n",
      "C:\\Users\\yinahe\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.multiclass import OneVsOneClassifier\n",
    "log_reg = LogisticRegression()\n",
    "ovo = OneVsOneClassifier(log_reg)\n",
    "ovo.fit(X_train, y_train)\n",
    "ovo.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
